package com.googlecode.stemwijzer.client.widget;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.googlecode.stemwijzer.shared.model.PoliticalParty;

public class PoliticalPartyInfoDialog extends DialogBox {

	private final VerticalPanel verticalPanel;

	public PoliticalPartyInfoDialog(final PoliticalParty politicalParty) {

		// Example of programmatic layout
		verticalPanel = new VerticalPanel();
		verticalPanel.add(politicalParty.getLogo());
		verticalPanel.add(new Label(politicalParty.getAbbreviation()));
		verticalPanel.add(new Label(politicalParty.getName()));
		verticalPanel.add(new Label(politicalParty.getLeader().getName()));
		verticalPanel.add(politicalParty.getLeader().getPhoto());
		verticalPanel.add(new Label());

		Button closeButton = new Button("Sluiten");
		closeButton.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				hide();
				Log.debug("Closed info dialog");
			}
		});

		verticalPanel.add(closeButton);

		add(verticalPanel);
		setAnimationEnabled(true);
		setText("Partij-informatie");

		Log.debug("Showing political party info dialog");

	}
}
